Santiago R. , 18.3.2021
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from IPython.display import Image
Image(filename='Messwerte.png', width = 800, height = 300)
#Messwerte
alpha = np.array([5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85])*2*np.pi/360
U_s = np.array([0.154,0.158,0.167,0.18,0.198,0.224,0.259,0.303,0.365,0.444,0.558,0.712,0.932,1.24, 1.676, 2.296,3.172])
U_s0 = 4.4
U_p = np.array([0.149,0.145,0.14,0.127,0.114,0.096,0.074,0.052,0.03,0.008,0.002,0.013,0.061,0.193,0.479,1.051,2.178])
U_p0 = 4.4
u_Us = U_s*0.01
u_Up = U_p*0.01
Für das Reflexionsvermögen des parallel $R_p$ und senkrecht $R_s$ polarisierten Laserstrahls stellen sich folgende Gleichungen zum Fitten zur Verfügung
$R_s= \frac{sin^2(\alpha _e - \alpha _g)}{sin^2(\alpha _e + \alpha _g)}$
$R_p= \frac{tan^2(\alpha _e - \alpha _g)}{tan^2(\alpha _e + \alpha _g)}$
wobei $\alpha _g$ sich aus den Brechungsgesetzen ergibt mit
$\alpha _g = arcsin(\frac{n_1}{n_2} sin(\alpha _e))$
def R_s(alpha_e, n1, n2):
alpha_g = np.arcsin(n1/n2*np.sin(alpha_e))
R = np.sin(alpha_e-alpha_g)**2/(np.sin(alpha_e+alpha_g)**2)
return np.sqrt(R)
def R_p(alpha_e, n1, n2):
alpha_g = np.arcsin(n1/n2*np.sin(alpha_e))
R = np.tan(alpha_e-alpha_g)**2/(np.tan(alpha_e+alpha_g)**2)
return np.sqrt(R)
Zur theoretischen Vorhersage mit $n_1=1$ für die Brechung in Luft und $n_2=1.5$ für die Brechung an Kronglas folgt
alpha_test = np.arange(0,5/10*np.pi,0.01)
plt.scatter(np.arctan(1.5/1.00028),0, label="Brewsterwinkel "r'$\alpha _k = 56.3 ^{\circ}$'" für "r'$n_2 = 1.5$',marker='x',linewidths=3)
plt.plot(alpha_test,R_s(alpha_test, 1, 1.5), label="Theoretische Kurve "r'$\sqrt{R_s(\alpha _k)}$')
plt.plot(alpha_test,R_p(alpha_test, 1, 1.5), label="Theoretische Kurve "r'$\sqrt{R_p(\alpha _k)}$')
plt.xlabel(r'$\alpha _k$'" in Radian")
plt.ylabel(r'$\sqrt{R(\alpha _k)}$')
plt.legend(loc="upper left")
plt.savefig("TheoryCurves.pdf")
An der Stelle, in dem die Kurve für parallel zur Brennebene polarisiertes Licht nach 0 verläuft, folgt für die Brechzahl $n_2$ des Glases;
$tan(\alpha _e)= \frac{n_2}{n_1} \Leftrightarrow n_2 = n_1 tan(\alpha _e)$
Mit $n_1 =1.00028$ als die Brechzahl von Luft. Aus den Messwert $R_p(55 ^{\circ}) = 0.002 \approx 0$ folgt dann
$n_2 = 1.00028 \cdot tan(55 ^{\circ}) \approx 1.43$
Dieser Wert kann dann als Anfangswert für das Fit-Algorithmus verwendet werden
Zum Fitten an die Messwerte gilt zusätzlich
$R(\alpha _e)= \frac{U_r (\alpha _e)}{U_e}$
s.d. gilt
$ \frac{U_{rs}(\alpha _k)}{U_e}=\frac{sin^2(\alpha _e - \alpha _g)}{sin^2(\alpha _e + \alpha _g)}$
$ \frac{U_{rp}(\alpha _k)}{U_e} =\frac{tan^2(\alpha _e - \alpha _g)}{tan^2(\alpha _e + \alpha _g)}$
def U_rs(alpha_e, n2):
n1 = 1.00028
alpha_g = np.arcsin(n1/n2*np.sin(alpha_e))
U = np.sin(alpha_e-alpha_g)**2/(np.sin(alpha_e+alpha_g)**2)
return U
def U_rp(alpha_e, n2):
n1 = 1.00028
alpha_g = np.arcsin(n1/n2*np.sin(alpha_e))
U = np.tan(alpha_e-alpha_g)**2/(np.tan(alpha_e+alpha_g)**2)
return U
#Fit von n2 des Prismas für senkrecht polarisiertes Licht
plt.scatter(alpha,np.sqrt(U_s/4.4), label="Messwerte",marker='x',linewidths=1)
plt.errorbar(alpha,np.sqrt(U_s/4.4), yerr=u_Us,fmt='o',marker='x')
fit_parameters_1, fit_cov = curve_fit(U_rs,alpha,U_s/4.4, p0 = 1.43)
fit_uncertainties = fit_cov[0,0]**0.5
plt.plot(alpha_test,np.sqrt(U_rs(alpha_test,*fit_parameters_1)), label="Fit")
plt.xlabel(r'$\alpha _k$'" in Radian")
plt.ylabel(r'$\sqrt{R(\alpha _k)} = \sqrt{\frac{U_{rs}(\alpha _k)}{U_e}}$')
plt.legend(loc="upper left")
plt.savefig("FitU_s.pdf")
print("n2 =", fit_parameters_1[0], "+/-", fit_uncertainties)
y = np.sqrt(U_s/4.4)
x = alpha
residuals = y - np.sqrt(U_rs(x,*fit_parameters_1))
ss_res = np.sum(residuals**2)
ss_tot = np.sum((y-np.mean(y))**2)
R_2 = 1 - (ss_res / ss_tot)
plt.scatter(x,residuals, label='R^2 ='+str(np.round(R_2,7)))
plt.xlabel(r'$\alpha _k$'" in Radian")
plt.ylabel("Differenz "r'$y- \sqrt{\frac{U_{rs}(\alpha _k)}{U_e}}$')
plt.legend(loc="upper right")
#plt.rcParams["figure.figsize"] = (8,1)
#plt.savefig("DispersionRes.pdf", bbox_inches = "tight")
print("R^2 =", R_2)
#Fit von n2 des Prismas für parallel polarisiertes Licht
plt.scatter(alpha,np.sqrt(U_p/4.4), label="Messwerte", marker='x',linewidths=1)
plt.errorbar(alpha,np.sqrt(U_p/4.4), yerr=u_Us,fmt='o',marker='x')
fit_parameters_2, fit_cov = curve_fit(U_rp,alpha,U_p/4.4, p0 = 1.43)
fit_uncertainties = fit_cov[0,0]**0.5
plt.plot(alpha_test,np.sqrt(U_rp(alpha_test,*fit_parameters_2)), label="Fit")
plt.xlabel(r'$\alpha _k$'" in Radian")
plt.ylabel(r'$\sqrt{R(\alpha _k)} = \sqrt{\frac{U_{rp}(\alpha _k)}{U_e}}$')
plt.legend(loc="upper left")
plt.savefig("FitU_p.pdf")
print("n2 =", fit_parameters_2[0], "+/-", fit_uncertainties)
y = np.sqrt(U_p/4.4)
x = alpha
residuals = y - np.sqrt(U_rp(x,*fit_parameters_1))
ss_res = np.sum(residuals**2)
ss_tot = np.sum((y-np.mean(y))**2)
R_2 = 1 - (ss_res / ss_tot)
plt.scatter(x,residuals, label='R^2 ='+str(np.round(R_2,7)))
plt.xlabel(r'$\alpha _k$'" in Radian")
plt.ylabel("Differenz "r'$y- \sqrt{\frac{U_{rp}(\alpha _k)}{U_e}}$')
plt.legend(loc="upper right")
#plt.rcParams["figure.figsize"] = (8,1)
#plt.savefig("DispersionRes.pdf", bbox_inches = "tight")
print("R^2 =", R_2)
#Gemeinsames Fit
#senkrecht Polarisiertes Licht
plt.scatter(alpha,np.sqrt(U_s/4.4), label="Messwerte "r'$\sqrt{\frac{U_{rs}(\alpha _k)}{U_e}}$',marker='x',linewidths=1)
plt.errorbar(alpha,np.sqrt(U_s/4.4), yerr=u_Us,fmt='o',marker='x')
plt.plot(alpha_test,np.sqrt(U_rs(alpha_test,*fit_parameters_1)), label="Fit "r'$ \sqrt{\frac{sin^2(\alpha _e - \alpha _g)}{sin^2(\alpha _e + \alpha _g)}}$'" mit "r'$n_2 = 1.4595$')
#Parallel Polarisiertes Licht
plt.scatter(alpha,np.sqrt(U_p/4.4), label="Messwerte "r'$\sqrt{\frac{U_{rp}(\alpha _k)}{U_e}}$', marker='x',linewidths=1)
plt.errorbar(alpha,np.sqrt(U_p/4.4), yerr=u_Us,fmt='o',marker='x')
plt.plot(alpha_test,np.sqrt(U_rp(alpha_test,*fit_parameters_2)), label="Fit "r'$ \sqrt{\frac{tan^2(\alpha _e - \alpha _g)}{tan^2(\alpha _e + \alpha _g)}}$'" mit "r'$n_2 = 1.4585$')
#Plot-Einstellungen
plt.xlabel(r'$\alpha _k$'" in Radian")
plt.ylabel(r'$\sqrt{R(\alpha _k)} = \sqrt{\frac{U_{r}(\alpha _k)}{U_e}}$')
plt.legend(loc="upper left", fontsize = "small")
plt.savefig("FitU_g.pdf")
#Residuen senkrechte polarisation
y = np.sqrt(U_s/4.4)
x = alpha
residuals = y - np.sqrt(U_rs(x,*fit_parameters_1))
ss_res = np.sum(residuals**2)
ss_tot = np.sum((y-np.mean(y))**2)
R_2 = 1 - (ss_res / ss_tot)
plt.scatter(x,residuals, label='Residuen U_rs, R^2 ='+str(np.round(R_2,7)))
#Residuen parallele polarisation
y = np.sqrt(U_p/4.4)
x = alpha
residuals = y - np.sqrt(U_rp(x,*fit_parameters_1))
ss_res = np.sum(residuals**2)
ss_tot = np.sum((y-np.mean(y))**2)
R_2 = 1 - (ss_res / ss_tot)
plt.scatter(x,residuals, label='Residuen U_rp, R^2 ='+str(np.round(R_2,7)))
plt.xlabel(r'$\alpha _k$'" in Radian")
plt.ylabel("Differenz "r'$y- \sqrt{\frac{U_{r}(\alpha _k)}{U_e}}$')
plt.ylim(-0.01, 0.025)
plt.legend(loc="upper right", prop={'size': 8})
plt.gca().set_aspect(aspect=18)
#plt.rcParams["figure.figsize"] = (8,1)
plt.savefig("Residuen.pdf", bbox_inches = "tight")
print("R^2 =", R_2)
#Der Brewster-Winkel ist dann
alpha_b = np.arctan(1.459/1.00028)*360/(2*np.pi)
print(alpha_b)